// 元组类型
let a: [number, string] = [1, '张三']
let a1: [number, string];
a1 = [2, '李四']

// 数组类型any
let arr: number[] = [1, 2, 3, 4]
let arr1: number[] = []
arr1 = [5, 6, 7, 8]
let Any: any = []
Any = ['zwd', 23, '女']

// number
let isNumber: number = 1;
let isNumber1: number
isNumber1 = 2

// string
let isString: string = 'ZWD'
let isString1: string
isString1 = 'ABC'

// boolean
let isfalg: boolean = false
let isflag1: boolean
isflag1 = true

// 枚举 eunm
enum Color { Red, Green, Blue }
let c: Color = Color.Green;
// console.log(c);

//void 类型像是与any类型相反，
function Voids(): void {
    console.log('this is void');
}
Voids()
let Voids1: void = undefined;
// console.log(Voids1);


// undefined  null 
let isundefined: undefined = undefined
let isNull: null = null
// console.log(isundefined,isNull);




// 定义数组
let Arr: [string, number, boolean] = ['zhang', 1, false]
let Arr1: [string, number, boolean];
Arr1 = ['zhangsan', 2, true]


// 第一个是字符串  第二个是数组
let StrAny: [string, any] = ['老三', [1, 2, 3, 'ABC']]
console.log(StrAny);

// 常见的js的数组方法
let num = [1, 2, 3, 4, 5]
let b = [11, 12, 13, 14]
num.push(6, 7, 8, 9, 10)//后添加
num.unshift(-2, -1, 0)//前添加
num.pop()//删除最后一个
num.shift()//删除第一个
num.concat(b)//合并
num.sort()//排序
num.slice()//截取
num.splice(5, 1)
// console.log(num);
// map forEach filter reverse(倒序) join字符串


// pop
function My_pop(str) {
    str.length = str.length - 1
    return str
}
console.log(My_pop([1, null, NaN, 2, undefined]));


// push
// let Mypush=(A,B,C)=>{ 
//     console.log(A,B,C);

// }
// console.log(Mypush([1,2,3],'hello','word'));
// console.log(Mypush(['上海','北京','宿迁'],'hello','word'));

//二维数组转一维
function list(arrs) {
    let str = []
    for (let i = 0; i < arrs.length; i++) {
        for (let j = 0; j < arrs[i].length; j++) {
            str.push(arrs[i][j])
        }
    }
    // 去重
    let ArrStr = new Set(str)
    return ArrStr
}
console.log(list([[1, 2, 3], [4, 5, 6], [7, 8, 9, 0, 0, 0]]));
